require(['jquery', 'layui', './dev/layConfig', 'echarts'], function ($, layui, lays, echarts) {

  var chartWih = 310.75+"px"
  var chartHig = 246+"px"

  $(".chart-box").css({
    "width":chartWih,
    "height":chartHig,
    "margin":"0 auto"
  });


  layui.config(lays)
    .use('element')
    .use('form')
    .link('http://www.ytbuyer.com/style/commons/reset.css')
    .link('./js/vendor/layui/src/css/layui.css')
    .link('./css/index.css');

  //指定图标的配置和数据
  var option = {
    title: {
      text: 'ECharts 数据统计'
    },
    toolbox: {
      show: true,
      feature: {
        saveAsImage: {
          show: true
        }
      }
    },
    legend: {
      data: ['销量']
    },
    xAxis: {
      data: ["Android", "IOS", "PC", "Ohter"]
    },
    yAxis: {},
    series: [{
      name: '销量',
      type: 'bar',
      data: [500, 200, 360, 800]
    }]
  };

  var option1 = {
    title: {
      text: 'ECharts 数据统计'
    },
    toolbox: {
      show: true,
      feature: {
        saveAsImage: {
          show: true
        }
      }
    },
    legend: {
      data: ['销量']
    },
    xAxis: {
      data: ["Android", "IOS", "PC", "Ohter"]
    },
    yAxis: {},
    series: [{
      name: '销量',
      type: 'pie',
      data: [500, 200, 360, 800]
    }]
  };


  //初始化echarts实例
  var myChart1 = echarts.init(document.getElementById('chart1'));

  var myChart2 = echarts.init(document.getElementById('chart2'));

  //使用制定的配置项和数据显示图表
  myChart1.setOption(option);

  myChart2.setOption(option1);



});


